package mysql

import (
	"log"

	en "github.com/timest/env"
)

var (
	// MysqlConfig :
	MysqlConfig *mysqlConfig
)

type mysqlConfig struct {
	// Mysql :
	MysqlHost   string `env:"MYSQL_HOST" default:"localhost"`
	MysqlPort   string `env:"MYSQL_PORT" default:"3306"`
	MysqlDBName string `env:"MYSQL_DB_NAME" default:"cron-dev"`
	MysqlUser   string `env:"MYSQL_USER" default:"root"`
	MysqlPwd    string `env:"MYSQL_PWD" default:"1234qwer"`
	MysqlIsMock string `env:"MYSQL_IS_MOCK" default:"false"`
}

func initEnv() {
	MysqlConfig = new(mysqlConfig)
	en.IgnorePrefix()
	err := en.Fill(MysqlConfig)
	log.Printf("[INFO] MysqlConfig :%+v\n", MysqlConfig)
	if err != nil {
		log.Printf("[ERROR] MysqlConfig :%+v\n", err)
	}
}
